package job1;

/*
编写一个员工类   (1)属性: 姓名,年龄       如果年龄小于18龄大于150抛出年龄异常       如果姓名为null或者""抛出空异常
 */
public class Main {
    public static void main(String[] args) {
        try {
//            正常运行，合法姓名 和 合法年龄
            Staff staff = new Staff("zhaoyu", 25);
            System.out.println("正常构造对象：" + staff);
        } catch (AgeIllegalException | NameEmptyException e) {
            e.printStackTrace();
        }
        try {
            // 运行异常，跑出年龄不合法异常
            Staff staff = new Staff("lvbu", 15);
        } catch (AgeIllegalException | NameEmptyException e) {
            e.printStackTrace();
        }
        try {
            // 运行异常，抛出姓名为空异常
            Staff staff = new Staff("", 22);
        } catch (AgeIllegalException | NameEmptyException e) {
            e.printStackTrace();
        }
    }

}
